﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BindingBasics
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            Persona soni = new Persona() { UniqueId = 1019, Edad = 25, Nombre = "Sonia Blanco" };
                       personaBindingSource.DataSource = soni;
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Persona persona = personaBindingSource.DataSource as Persona;
            persona.CumplirAnnos();
            persona.Save();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            personaBindingSource.DataSource = new Persona() {UniqueId = 8010, Edad = 28, Nombre = "Miguel Ruiz" };
        }
    }
}
